package com.shujia.flink.source

import org.apache.flink.api.scala._
import org.apache.flink.streaming.api.scala.StreamExecutionEnvironment

object Demo1Source {
  def main(args: Array[String]): Unit = {

    val env = StreamExecutionEnvironment.getExecutionEnvironment

    //读取本地文件 构建source   有界流
    val lines = env.readTextFile("flink/data/students.txt")

    //可以没有sink  中间的转换过程也会执行
    lines.map(line => {
      println("map")
    })

    //基于本地集合   有界流
    val ds1 = env.fromCollection(List("java", "spark"))
    //
    //
    //    //连接socket构建ds  无界流
    val ds2 = env.socketTextStream("node1", 8888)
    ds2.print()

    env.execute("Demo1Source")

  }
}
